﻿@using PopForums.Controllers;
@model List<PopForums.Models.ModerationLogEntry>

@{
    ViewBag.PageTitle = PopForums.Resources.ModerationLog;
    Layout = "~/Areas/PopForums/Views/Admin/AdminMaster.cshtml";
}

<h1>@PopForums.Resources.ModerationLog</h1>

@using (Html.BeginForm())
{
<table class="settings">
	<tr>
		<td>@PopForums.Resources.StartDate</td>
		<td>@Html.TextBox("start")</td>
	</tr>
	<tr>
		<td>@PopForums.Resources.EndDate</td>
		<td>@Html.TextBox("end")</td>
	</tr>
	<tr>
		<td></td>
		<td><input type="submit" value="@PopForums.Resources.Search" /></td>
	</tr>
</table>
}

@if (Model != null)
{
<table class="stripe">
	<tr>
		<th>@PopForums.Resources.EventTime</th>
		<th>@PopForums.Resources.Name</th>
		<th>@PopForums.Resources.Type</th>
		<th>@PopForums.Resources.TopicID</th>
		<th>@PopForums.Resources.PostID</th>
	</tr>
	@foreach (var entry in Model)
	{
		<tr>
			<td>@this.FormatTime(entry.TimeStamp)</td>
			<td>@Html.ActionLink(entry.UserName, "ViewProfile", AccountController.Name, new { id = entry.UserID }, new { target = "_blank" })</td>
			<td>@entry.ModerationType</td>
			<th>@Html.ActionLink(entry.TopicID.ToString(), "TopicID", ForumController.Name, new { id = entry.TopicID }, new { target = "_blank" })</th>
			<th>
				@if (entry.PostID.HasValue) { 
					@Html.ActionLink(entry.PostID.Value.ToString(), "PostLink", ForumController.Name, new { id = entry.PostID.Value }, new { target = "_blank" })
	}
			</th>
		</tr>
		if (!String.IsNullOrEmpty(entry.Comment) || !String.IsNullOrEmpty(entry.Comment))
		{
			<tr>
				<td colspan="5" style="border-bottom: solid 1px black;">
					<p>@PopForums.Resources.Comment: @entry.Comment</p>
					@Html.Raw(entry.OldText)
				</td>
			</tr>
		}
	}
</table>
}